<%@ page import="com.dbc.StudentsDB" %>
<%@ page import="java.util.List" %>
<%@ page import="com.vo.Students" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.dbc.ClassesDB" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
	<meta charset="UTF-8">
	<title>显示学生列表</title>
	<meta name="author" content="软件1814 陈志恩 201821122100">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="static/css/font.css">
	<link rel="stylesheet" href="static/css/weadmin.css">

	<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
	<!--[if lt IE 9]>
	<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
</head>

<body>
<%StudentsDB sdb = new StudentsDB();
	request.setCharacterEncoding("utf-8");
	String stuId = request.getParameter("stuId");
	String stuName = request.getParameter("stuName");
	String className = request.getParameter("className");
	if(stuId==null) stuId="";
	if(stuName==null) stuName="";
	if(className==null) className="";
	List<Students> students = sdb.getStuByLike(stuId,stuName,className);
	ClassesDB cdb = new ClassesDB();
	Map<Integer,String> classesMap = cdb.getClassesMap();
	int count =0;
%>
<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a>
          <cite>学生列表</cite></a>
      </span>
	<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
		<i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="weadmin-body">
	<div class="layui-row">
		<form class="layui-form layui-col-md12 we-search" action="./showStudents.jsp" method="post">
			<div class="layui-inline">
				<input type="text" name="stuId" placeholder="请输入学号" autocomplete="off" class="layui-input" value="<%=stuId%>">
			</div>
			<div class="layui-inline">
				<input type="text" name="stuName" placeholder="请输入姓名" autocomplete="off" class="layui-input" value="<%=stuName%>">
			</div>
			<div class="layui-inline">
				<input type="text" name="className" placeholder="请输入班级" autocomplete="off" class="layui-input" value="<%=className%>">
			</div>
			<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
		</form>
	</div>
	<div class="weadmin-block">
		<button class="layui-btn" onclick="WeAdminShow('添加学生','./insertStudents.jsp',500,500)"><i class="layui-icon"></i>添加</button>

		<span class="fr" style="line-height:40px">共有数据：<%=students.size()%> 条</span>
	</div>
	<table class="layui-table">
		<thead>
		<tr>
			<th>序号</th>
			<th>学号</th>
			<th>姓名</th>
			<th>性别</th>
			<th>密码</th>
			<th>班级</th>
			<th>操作</th>
		</thead>
		<tbody>
		<%for (Students stu:students) {%>
		<tr>
			<td><%=++count%></td>
			<td><%=stu.getStudentId()%></td>
			<td><%=stu.getStudentName()%></td>
			<td><%=stu.getSex()%></td>
			<td><%=stu.getStudentPwd()%></td>
			<td><%=classesMap.get(stu.getClassId())%></td>
			<td class="td-manage">
				<a title="编辑" onclick="WeAdminShow('编辑','./updateStudents.jsp?studentId=<%=stu.getStudentId()%>',500,450)" href="javascript:;">
					<i class="layui-icon">&#xe642;</i>
				</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<a title="删除" onclick="WeAdminShow('删除','./deleteStudents.jsp?studentId=<%=stu.getStudentId()%>&studentName=<%=stu.getStudentName()%>',400,300)" href="javascript:;">
					<i class="layui-icon">&#xe640;</i>
				</a>
			</td>
		</tr>
		<%}%>
		</tbody>
	</table>
</div>
<script src="lib/layui/layui.js" charset="utf-8"></script>
<script src="static/js/admin.js" type="text/javascript" charset="utf-8"></script>
</body>

</html>